package com.collectionday03demo;

import java.util.ArrayList;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] ss = {"11","22","33","44","55"};
        for (int i = 0; i < ss.length; i++) {
            System.out.print(ss[i] + " ");
        }
        System.out.println();


        ArrayList<String> arr = new ArrayList<>();
        arr.add("1");
        arr.add("2");
        arr.add("3");
        arr.add("4");
        arr.add("5");
        Iterator<String> ite = arr.iterator();
        while (ite.hasNext()){
            String s = ite.next();
            System.out.print(s+" ");
        }
        System.out.println();

        //增强for  底层采用的迭代器模式
        //冒号左边是 元素类型 和变量名    右边是 集合
        for (Object obj : arr){

            System.out.print(obj + " ");
        }


    }
}
